<?
/**
*Blijashie/Proshedshie sobitiya v place footer
 * 
**/
global $infopark;
$cc=$infopark->get_city_by_url();
$current_city=$cc['tid'];
$categories_names=$infopark->get_event_taxonomy();
$cities_list=$infopark->cities_list();


 $past_events=$infopark->split_events_by_my($block->{'#all_past_events'});
$current_events=$infopark->split_events_by_my($block->{'#all_current_events'});
 #pre($past_events);
?>
<section id="<?php print $block_html_id; ?>" >
 <div class="events_in_place">
 <?if(count($block->{'#all_current_events'})):?><h3 class="active_tab tabepf" onClick="sw_events_in_place('future')">Ближайшие события <div class="afishe_count"><?=count($block->{'#all_current_events'});?></div></h3><?endif;?> 
 <?if(count($block->{'#all_past_events'})):?><h3 class="tabepp<?if(count($block->{'#all_current_events'})==0){echo " active_tab";}?>" onClick="sw_events_in_place('past')">Прошедшие события</h3><?endif;?> 
</div>
     

 <!--div id="columns" class="future_events"-->
 <div class="future_events">
<?php 

$first=1;
if($current_events)
foreach ($current_events as $day=>$events) : 
     
    $fid=md5($day);
    
    echo '<h4 onclick="show_box(\'.dayblock'.$fid.'\',\'.dayheader'.$fid.'\')" class="other_tickets dayheader'.$fid.($first?' other_ticket_opened':'').'">'.$day
            .'<div class="eventdate place_month_count">'.count($events).'</div></h4>'
            . '<div class="dayblock'.$fid.'" '.($first?'':'style="display:none;"').'>';
foreach($events as $event):

$arg=array('e'=>$event,
					'current_city'=>$current_city,
					'categories_names'=>$categories_names,
					'cities_list'=>$cities_list,
					'places'=>$places);	
?>
                   
					<?echo $infopark->_spec_event_place($arg,'future');?>
                  
                <?php endforeach; ?>
 </div>
                <?php
                $first=0;
                endforeach; ?>
</div>


 <!--div id="columns" class="past_events"-->
 <div class="past_events">   
<?php 
$pfirst=1;

foreach ($past_events as $day=>$events) : 
      $pid=md5($day);
 echo '<h4 onclick="show_box(\'.dayblockp'.$pid.'\',\'.dayheaderp'.$pid.'\')" class="other_tickets dayheaderp'.$pid.($pfirst?' other_ticket_opened':'').'">'.$day
         .'<div class="eventdate place_month_count">'.count($events).'</div></h4>'
         . '<div class="dayblockp'.$pid.'" '.($pfirst?'':'style="display:none;"').'>';
 if(count($events))
foreach($events as $event):

	$arg=array('e'=>$event,
					'current_city'=>$current_city,
					'categories_names'=>$categories_names,
					'cities_list'=>$cities_list,
					'places'=>$places);	
?>
	           
				<?
				echo _spec_event_place($arg);
				?>
	           
				<?php endforeach; ?>
 </div>
                    <?php
                    $pfirst=0;
                    endforeach; ?>
</div>
<?echo $infopark->js_init_events('lnk',$block->{'#all_current_events'});?>
<?echo $infopark->js_init_events('lnk',$block->{'#all_past_events'});?>
<?if(count($block->{'#all_current_events'})):?><script>jQuery(".past_events").hide();</script><?endif;?>
		
</section>
